package com.test.rpc.client;

import com.test.rpc.api.HelloService;
import com.test.rpc.api.Person;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class HelloClient {
    public static void main(String[] args) throws Exception {
        ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
        RpcProxy rpcProxy = context.getBean(RpcProxy.class);

        HelloService helloService = rpcProxy.create(HelloService.class);
        String result = helloService.hello("Hello World");
        System.out.println(result);
        HelloService helloService1 = rpcProxy.create(HelloService.class);
        String result1 = helloService1.hello(new Person("张","三"));
        System.out.println(result1);
        System.exit(0);
    }
}
